# !/usr/bin/env python
# -*-coding:utf-8 -*-

"""
# Author     ：skyTree
# version    ：python 3.11
# Description：Flask配置文件
"""
import os


class Config:
    DEBUG = True
    SECRET_KEY = 'fjwegmwpogemewogjopewgmweopgmewgpomgoewpmgewgmmg'

    # 配置数据库连接
    MYSQL_DIALECT = 'mysql'
    MYSQL_DIRVER = 'pymysql'
    MYSQL_NAME = 'root'
    MYSQL_PWD = '123456'
    MYSQL_HOST = 'localhost'
    MYSQL_PORT = 3306
    MYSQL_DB = 'flask_baizhan'
    MYSQL_CHARSET = 'utf8mb4'
    SQLALCHEMY_DATABASE_URI = f'{MYSQL_DIALECT}+{MYSQL_DIRVER}://{MYSQL_NAME}:{MYSQL_PWD}@{MYSQL_HOST}:{MYSQL_PORT}/{MYSQL_DB}?charset={MYSQL_CHARSET}'
    SQLALCHEMY_TRACK_MODIFICATIONS = True

    ALLOWED_IMG = {'bmp', 'png', 'jpg', 'jpeg', 'gif'}
    BASE_DIR = os.path.dirname(os.path.abspath(__file__))
    SERVER_IMG_UPLOADS = os.path.join(BASE_DIR, 'static', 'img')

    CELERY_RESULT_BACKEND = 'redis://localhost'
    CELERY_BROKER_URL = 'redis://localhost'


class DevelopConfig(Config):
    """开发环境配置"""
    DEBUG = True


class ProductConfig(Config):
    """生产环境配置"""
    DEBUG = False


config_dict = {
    'develop': DevelopConfig,
    'product': ProductConfig
}
